<template>
  <div>
    <div class="scl"><SearchLine :is="false" @search-info="search" /></div>
    <div class="sq"><Square :tasks="tasks" /></div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import SearchLine from '@/components/AppProvider/searchline/index.vue'
import Square from '@/components/AppProvider/square/index.vue'
import { searchinfoPost } from '@/api/post'
import { onMounted } from 'vue'
onMounted(() => {
  search({})
})
const tasks = ref([
  {
    create_at: '2022-05-21',
    task_name: '功夫熊猫2',
    description:
      '权据油办入标着备议完管期毛子石亲。京素命什头布难值受存者量东任。着始料亲道称海民着队他取。外月内型根统点权持是大万点想点运转。',
    status: '2',
    amount: '1',
    type: '1',
    task_id: 2,
  },
])
async function search(info) {
  // console.log(tasks.value)
  // console.log('*******************')
  // console.log({
  //   create_at: info.create_at,
  //   task_name: info.task_name,
  //   amount: info.amount,
  //   type: info.type,
  //   state: info.state,
  // })
  const res = await searchinfoPost({
    create_at: info.create_at,
    task_name: info.task_name,
    amount: info.amount,
    type: info.type,
    task_id: null,
  })
  tasks.value = res
  console.log(tasks.value)
}
// function (data) {
//   var date = new Date(data)
//   var Y = date.getFullYear() + '-'
//   var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
//   var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' '
//   var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
//   var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'
//   var s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds())
//   return Y + M + D + h + m + s
// }
</script>

<style lang="scss" scoped>
.scl {
  margin-top: 50px;
  margin-left: 8%;
}
.sq {
  margin-top: 50px;
  margin-left: 8%;
}
</style>
